package com.lee.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Results;

import com.lee.entity.UserInfo;

@Mapper
public interface UserInfoDao {
	
  
	@Insert("insert into userinfo(password,tel) values(#{pass},#{tel})")
	boolean addUserInfo(UserInfo userinfo);

		
	@Select("select * from userinfo where tel=#{tel}")
	@Results({
		@Result(property="user_id",column="id"),
		@Result(property="pass",column="password"),
		@Result(property="tel",column="tel"),
	})
	UserInfo findUserInfo(@Param("tel") String tel);
	
	@Select("select * from userinfo where tel=#{tel}")
	@Results({
		@Result(property="user_id",column="id"),
		@Result(property="pass",column="password"),
		@Result(property="tel",column="tel"),
	})
	boolean validateUserInfo(@Param("tel") String tel);
	
	@Update("update userinfo set password=#{pass} where id=#{user_id}")
	boolean updatePassword(UserInfo userinfo);
	
	

}
